// Town script for town 37: Emerging hut

begintownscript;

variables;

int x,i,j,choice;

body;

beginstate INIT_STATE;
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;

	if (get_flag(37,2) == 0) {
			message_dialog("You emerge in a hut, it seems. The walls are made of wood. However, the red carpet and mosaic floor makes one think this is an important place. You hope this will bring you to Thralni.","");
			set_flag(37,2,1);
			}

break;

beginstate 10;
reset_dialog();
add_dialog_str(0,"A big teleporter, very strong it seems, is humming in a pleasant way in front of you. You gather this is the teleporter that should teleport you back to the surface.",0);
add_dialog_choice(0,"Enter it");
add_dialog_choice(1,"Leave");
choice = run_dialog(1);
	
	if (choice == 1) {
			put_boom_on_char(0,2,0);
			put_boom_on_char(1,2,0);
			put_boom_on_char(2,2,0);
			put_boom_on_char(3,2,0);
			put_boom_on_char(4,2,0);
			put_boom_on_char(5,2,0);
			run_animation_sound(10);
			run_animation();
			change_outdoor_location(0,0,15,26);
			move_to_new_town(2,6,26);
			}
break;

beginstate 11;
if (get_flag(37,0) == 1)
		end();
	message_dialog("This hut is filled to the top with webs. It is really disgusting to look at. At the other side of the south wall, you think you hear high chittering sounds.","");
	set_flag(37,0,1);
break;

beginstate 12;
if (get_flag(37,1) == 1)
		end();
	message_dialog("The sounds definitely come from this room. You could go in, but with all the webs in mind, you can already guess what's in there...","");
	set_flag(37,1,1);
break;